home *** CD-ROM | disk | FTP | other *** search
- s32 CheckCache(mcString CacheName, mcString id1, mcString id2,mcString id3,mcString id4)
- {
- RESIDENTMAISON rm;
- WORLDRESIDENT Cache;
- mcString cachetemp;
- s32 Go;
-
- Go = 1;
- cachetemp = CacheName;
-
- if( id1 != "" )
- {
-
- rm = GetResidentMaison( id1);
- Go = RM_GetNbCompound(rm);
-
- if( Go == 0 )
- {
- Cache = GetWorldResident(cachetemp);
- WR_Visible(Cache,0);
- return 0;
- }
- }
-
- if( id2 != "" )
- {
- rm = GetResidentMaison( id2);
- Go = RM_GetNbCompound(rm);
-
- if( Go == 0 )
- {
- Cache = GetWorldResident(cachetemp);
- WR_Visible(Cache,0);
- return 0;
- }
- }
-
- if( id3 != "" )
- {
- rm = GetResidentMaison( id3);
- Go = RM_GetNbCompound(rm);
-
- if( Go == 0 )
- {
- Cache = GetWorldResident(cachetemp);
- WR_Visible(Cache,0);
- return 0;
- }
- }
-
- if( id4 != "" )
- {
- rm = GetResidentMaison( id4);
- Go = RM_GetNbCompound(rm);
-
- if( Go == 0 )
- {
- Cache = GetWorldResident(cachetemp);
- WR_Visible(Cache,0);
- return 0;
- }
- }
-
- return 1;
- }
-
- s32 CheckStatus(mcString nom)
- {
- WORLDRESIDENT wr;
- wr = GetWorldResident(nom);
-
- if( GetCurrPDV(wr) == 0.0 )
- return -2;
-
- if( GetSaved(wr) == 1 )
- return 1;
-
- return 0;
- }
-
- // ajoute une porte
- s32 addDoor (s32 doorId)
- {
- s32 nbDoors;
- nbDoors = GetVariable("nbDoors");
-
- // on crΘe la variable avec son nombre de caches et son nombre de link
- AddVariable( "tabDoors" + nbDoors ,doorId);
- AddVariable( "d" + doorId + "NbCaches" ,0);
- AddVariable( "d" + doorId + "NbLinks" ,0);
-
- // et hop un cache de plus
- SetVariable("nbDoors", nbDoors+1 );
-
- return 0;
- }
-
- // ajoute un cache liΘ α la derniΦre porte
- s32 enqueueCache (s32 cacheId)
- {
- s32 lastDoorId;
- s32 nbCaches;
-
- lastDoorId = GetVariable( "tabDoors" + ( GetVariable("nbDoors")-1 ) );
- nbCaches = GetVariable("d" + lastDoorId + "nbCaches");
-
- AddVariable( "d" + lastDoorId + "c" + nbCaches ,cacheId);
-
- // on incrΘmente nbCaches
- SetVariable( "d" + lastDoorId + "nbCaches" , nbCaches+1 );
-
- return 0;
- }
-
- // ajoute un hp_link liΘ α la derniΦre porte
- s32 enqueueLink (s32 linkId)
- {
- s32 lastDoorId;
- s32 nbLinks;
-
- lastDoorId = GetVariable( "tabDoors" + ( GetVariable("nbDoors")-1 ) );
- nbLinks = GetVariable("d" + lastDoorId + "NbLinks");
-
- AddVariable( "d" + lastDoorId + "l" + nbLinks ,linkId);
-
- // on incrΘmente nbLinks
- SetVariable( "d" + lastDoorId + "NbLinks" , nbLinks+1 );
-
- return 0;
- }
-
- // vΘrifie toutes les portes
- s32 checkAllDoors ()
- {
- s32 nbDoors;
- s32 nbCaches;
- s32 nbLinks;
- s32 doorId;
- s32 i;
- s32 j;
- s32 butine;
-
- nbDoors = GetVariable("nbDoors");
-
- // on dΘfile toutes les portes
- for (i=0; i<nbDoors; i+=1)
- {
- doorId = GetVariable( "tabDoors"+i );
-
- butine = RM_GetNbCompound( GetResidentMaison( "porte" + doorId ) );
-
- // si la porte est butinΘe
- if (butine == 0)
- {
- nbCaches = GetVariable("d" + doorId + "nbCaches");
- nbLinks = GetVariable("d" + doorId + "NbLinks");
-
- // on lance la fonction liΘe (porte)
- AddFunction_Events("doorOnBreak" + doorId,0,1);
-
- // on dΘfile ses caches
- for (j=0; j<nbCaches; j+=1)
- {
- // on retire le cache
- if ( ActivateHiddenZone( "cache" + GetVariable( "d" + doorId + "c" + j ) ) )
- {
- // on lance la fonction liΘe (cache)
- AddFunction_Events("cacheOnShow" + GetVariable( "d" + doorId + "c" + j ),0,1);
- }
- }
-
- // on dΘfile ses hplinks et on les dΘsactive
- for (j=0; j<nbLinks; j+=1)
- {
- SetHotpointLinkActivated( GetVariable("d" + doorId + "l" + j) ,0);
- }
-
- // pour finir on la retire du tableau (on met la derniΦre α sa place...)
- if (i != (nbDoors-1))
- {
- SetVariable( "tabDoors" + i , GetVariable("tabDoors" + (nbDoors-1) ) );
-
- }
- SetVariable("nbDoors", (nbDoors-1) );
-
- }
- }
-
- return 0;
- }
-